//
//  PeopleWXView.m
//  markmap
//
//  Created by 甘世清 on 2025/2/10.
//

#import "PeopleWXView.h"

@implementation PeopleWXView

-(void)SQ_UIViewForSelfView{
    
    self.backgroundColor = UIColor.whiteColor;
    
    self.layer.cornerRadius = 30;
    
    [self addSubview:self.chatLabel];
    [self.chatLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self);
            make.top.equalTo(self).offset(40);
    }];
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setTitle:SQNSLocalString(@"点击复制") forState:normal];
    btn.titleLabel.font = FONT_REGULAR(14);
    [btn setTitleColor:UIColor.blueColor forState:normal];
    [self addSubview:btn];
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self);
            make.top.equalTo(self.chatLabel.mas_bottom).offset(10);
            make.width.mas_equalTo(200);
            make.height.mas_equalTo(54);
    }];
    [btn addTarget:self action:@selector(SQ_ButtonClick) forControlEvents:UIControlEventTouchUpInside];
}

-(void)SQ_ButtonClick{
        UIPasteboard *pab = [UIPasteboard generalPasteboard];
        pab.string = self.chatLabel.text;
      if (pab == nil) {
          [YJProgressHUD showMsgWithoutView:SQNSLocalString(@"复制失败")];
      } else {
          [YJProgressHUD showMsgWithoutView:SQNSLocalString(@"复制成功")];
      }
}

- (UILabel *)chatLabel{
    if (!_chatLabel) {
        _chatLabel = [[UILabel alloc]init];
        _chatLabel.font = FONT_MEDIUM(14);
        _chatLabel.textColor = SQColor333333;
    }
    return _chatLabel;
}

@end
